package install.ren.exercise.test.aop;

import com.ctrip.framework.apollo.ConfigService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.EnableLoadTimeWeaving;
import org.springframework.context.annotation.LoadTimeWeavingConfigurer;
import org.springframework.instrument.classloading.LoadTimeWeaver;

/**
 * @author jonny
 * Created on 2021/8/29
 */
@SpringBootApplication
@EnableLoadTimeWeaving(aspectjWeaving = EnableLoadTimeWeaving.AspectJWeaving.AUTODETECT)
//@EnableAspectJAutoProxy
public class MainSpringBoot implements LoadTimeWeavingConfigurer {
    static Logger log = LoggerFactory.getLogger(MainSpringBoot.class);

    @Override
    public LoadTimeWeaver getLoadTimeWeaver() {
        ExtInstrumentationLoadTimeWeaver ltw = new ExtInstrumentationLoadTimeWeaver();
        return ltw;
    }
    public static void main(String[] args) throws Exception {
        SpringApplication.run(MainSpringBoot.class, args);
        DemoBean demoBean = new DemoBean();
        demoBean.run1();
        DemoBean.runStatic();

        System.setProperty("env", "fat");
        ConfigService.setAppId("AppSampleHelloBoot");

        log.info(ConfigService.getAppConfig().getProperty("test",""));



    }
}
